<template>
  <div class="data-control-page">
    <!-- 数据科技风背景 -->
    <div class="data-background">
      <div class="data-grid">
        <div class="grid-lines horizontal">
          <div v-for="i in 15" :key="i" class="grid-line" :style="{ top: `${i * 6.67}%` }"></div>
        </div>
        <div class="grid-lines vertical">
          <div v-for="i in 20" :key="i" class="grid-line" :style="{ left: `${i * 5}%` }"></div>
        </div>
      </div>
      <div class="data-charts">
        <div v-for="i in 6" :key="i" class="chart-element" :style="getChartStyle(i)"></div>
      </div>
      <div class="data-streams">
        <div v-for="i in 12" :key="i" class="data-stream" :style="getStreamStyle(i)"></div>
      </div>
    </div>

    <div class="ios-container">
      <div class="ios-navbar">
        <IOSBackButton @click="router.back()" />
      </div>
      <div class="content-wrapper">
        <h1 class="page-title">📊 数据表管理</h1>
        <p class="page-description">强大的数据表格工具，支持导入导出、实时编辑、数据可视化</p>
        
        <div class="feature-grid">
          <div class="feature-card">
            <div class="feature-icon">📈</div>
            <h3>数据可视化</h3>
            <p>实时图表展示</p>
          </div>
          <div class="feature-card">
            <div class="feature-icon">⚡</div>
            <h3>快速编辑</h3>
            <p>在线表格编辑</p>
          </div>
          <div class="feature-card">
            <div class="feature-icon">💾</div>
            <h3>导入导出</h3>
            <p>多格式支持</p>
          </div>
          <div class="feature-card">
            <div class="feature-icon">🔍</div>
            <h3>智能分析</h3>
            <p>数据洞察挖掘</p>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
import IOSBackButton from '~/components/IOSBackButton.vue'
const router = useRouter()

const getChartStyle = (index) => {
  const charts = [
    { top: '15%', left: '10%', width: '120px', height: '80px' },
    { top: '25%', left: '75%', width: '100px', height: '60px' },
    { top: '45%', left: '20%', width: '140px', height: '90px' },
    { top: '65%', left: '70%', width: '110px', height: '70px' },
    { top: '75%', left: '15%', width: '130px', height: '85px' },
    { top: '35%', left: '55%', width: '90px', height: '65px' }
  ]
  const chart = charts[index - 1] || { top: '50%', left: '50%', width: '100px', height: '70px' }
  return {
    ...chart,
    animationDelay: `${(index - 1) * 0.3}s`
  }
}

const getStreamStyle = (index) => {
  return {
    left: `${Math.random() * 100}%`,
    animationDelay: `${index * 0.2}s`,
    animationDuration: `${2 + Math.random() * 2}s`
  }
}
</script>

<style scoped>
.data-control-page {
  min-height: 100vh;
  position: relative;
  overflow: hidden;
}

.data-background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  z-index: -1;
}

.data-grid {
  position: absolute;
  width: 100%;
  height: 100%;
}

.grid-lines {
  position: absolute;
  width: 100%;
  height: 100%;
}

.grid-line {
  position: absolute;
  background: rgba(255, 255, 255, 0.2);
}

.horizontal .grid-line {
  width: 100%;
  height: 1px;
  animation: gridPulse 3s ease-in-out infinite;
}

.vertical .grid-line {
  height: 100%;
  width: 1px;
  animation: gridPulse 3s ease-in-out infinite;
}

.data-charts {
  position: absolute;
  width: 100%;
  height: 100%;
}

.chart-element {
  position: absolute;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  backdrop-filter: blur(5px);
  animation: chartPulse 4s ease-in-out infinite;
}

.chart-element::before {
  content: '';
  position: absolute;
  bottom: 10px;
  left: 10px;
  right: 10px;
  height: 60%;
  background: linear-gradient(to top, 
    rgba(255, 255, 255, 0.6) 0%,
    rgba(255, 255, 255, 0.3) 50%,
    rgba(255, 255, 255, 0.1) 100%);
  border-radius: 4px;
  animation: chartFill 2s ease-in-out infinite alternate;
}

.data-streams {
  position: absolute;
  width: 100%;
  height: 100%;
}

.data-stream {
  position: absolute;
  width: 2px;
  height: 20px;
  background: linear-gradient(to bottom, 
    rgba(255, 255, 255, 0),
    rgba(255, 255, 255, 0.8),
    rgba(255, 255, 255, 0));
  animation: streamFlow 3s linear infinite;
}

.ios-container {
  position: relative;
  z-index: 1;
  max-width: 1000px;
  margin: 0 auto;
  padding: 20px;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}

.ios-navbar {
  padding: 10px 0;
  margin-bottom: 20px;
}

.content-wrapper {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-radius: 20px;
  padding: 40px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.page-title {
  font-size: 3rem;
  font-weight: 700;
  color: white;
  margin-bottom: 16px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
  text-align: center;
}

.page-description {
  font-size: 1.2rem;
  color: rgba(255, 255, 255, 0.9);
  text-align: center;
  margin-bottom: 40px;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-top: 40px;
}

.feature-card {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 15px;
  padding: 25px;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
}

.feature-card:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-5px);
}

.feature-icon {
  font-size: 2.5rem;
  margin-bottom: 15px;
}

.feature-card h3 {
  color: white;
  font-size: 1.3rem;
  margin-bottom: 10px;
  font-weight: 600;
}

.feature-card p {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.95rem;
}

@keyframes gridPulse {
  0%, 100% { opacity: 0.2; }
  50% { opacity: 0.5; }
}

@keyframes chartPulse {
  0%, 100% { 
    transform: scale(1);
    opacity: 0.6;
  }
  50% { 
    transform: scale(1.05);
    opacity: 0.9;
  }
}

@keyframes chartFill {
  0% { height: 30%; }
  100% { height: 70%; }
}

@keyframes streamFlow {
  0% {
    top: -20px;
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    top: 100%;
    opacity: 0;
  }
}

@media (max-width: 768px) {
  .content-wrapper {
    padding: 20px;
  }
  
  .page-title {
    font-size: 2rem;
  }
  
  .feature-grid {
    grid-template-columns: 1fr;
  }
}
</style>
